<#assign catId="" >
<#assign catName="" >
<#assign catSeoName="" >
<#assign catParentId=0 >
<#if obj??>
	<#if obj.type=='category'>
		<#assign catId="${obj.id}" >
		<#assign catName="${obj.name}" >
		<#assign catSeoName="${obj.seoName}" >
		<#assign catParentId="${obj.parentId}" >
	</#if>
</#if>

<form name="catForm" method="post" action="/admin/category" onsubmit="checkCat()">
	<input type="hidden" name="id" value="${catId}">
	<input type="hidden" name="oper" value="save">
	<input type="hidden" name="type" value="category">
	
	<input type="text" name="name" class="box2" placeholder="新分类目录名名称" value="${catName}">
	<input type="text" name="seoName" class="box2" placeholder="新分类目录别名" value="${catSeoName}">
	<select name="parentId" class="box3">
		<option value="0">无父级目录</option>
		<#list cats! as cat>
		<option value="${cat.id}" <#if catParentId?string==cat.id?string>selected</#if>>
			<@com.repeat cat.levelNum - 1>&nbsp;&nbsp;</@com.repeat>${cat.name}
		</option>
		</#list>
  	</select>
	<input type="submit" class="com_btn" value="保存">
	<input type="button" class="com_btn" value="清空" onclick="clearCat()">
</form>
<div class="in">			
	<#if cats?has_content>
		<table border="0" cellspacing="0" cellpadding="10" class="table_main">
		  <tbody><tr style="background-color:#d9d8d8; font-size:14px;">
			<td style="padding: 14px;"><strong>名称</strong></td>
			<td style="padding: 14px;" width="250"><strong>别名</strong></td>
			<td style="padding: 14px;" width="100"><strong>文章</strong></td>
		  </tr>
		  <#list cats as cat>
			  <tr class="<#if cat_index%2==0>gray</#if>">
				<td>
					<@com.repeat cat.levelNum - 1> － </@com.repeat>${cat.name}
					<div class="actions_wrapper">
					<div class="actions" style="display: none;">
						<a href="/admin/category?type=cats&id=${cat.id}">修改</a> |
						<a href="/admin/category?oper=delete&deleteType=cats&id=${cat.id}">删除</a>
					</div></div>
				</td>
				<td>${cat.seoName!}</td>
				<td>${cat.postCount}</td>
			  </tr>
		  </#list>
		</tbody></table>
		<p align="right">总数:${cats?size}</p>
	<#else>
  		<h2>还没有分类</h2>
	</#if>
</div>